<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="林镭特">
    <title></title>
    
    <style>
        main{
            width: 650px;
            margin: 0 auto;
        }
        ul{
            list-style: none;
            display: flex;
        }
        div{
            width: 50px;
            height: 50px;
            display: inline-block;
        }
        .red{
            background-color: red;
        }
        .green{
            background-color: green;
        }
        .black{
            background-color: black;
        }
        li{
            width: 85px;
            text-align: center;
            /* background-color: red; */
            margin-left: 5px;
        }


    </style>
</head>
<body>
    <!-- 2.网页换肤 -->
<main>
    <div class="red"></div>
    <div class="green"></div>
    <div class="black"></div>

    <ul>
        <li>新闻</li>
        <li>娱乐</li>
        <li>体育</li>
        <li>电影</li>
        <li>音乐</li>
        <li>旅游</li>
    </ul>
</main>

    
<script>
    var body=document.querySelector('body')
    var div=document.querySelectorAll('div')
    console.dir(div);
    var li=document.querySelectorAll('li')
    console.dir(li);

    div[0].onclick=function () {
        for(var i = 0; i <6 ; i++){
            li[i].style.backgroundColor='red';
            li[i].style.color='pink';
            body.style.backgroundColor='#333'
        }
    }
    div[1].onclick=function () {
        for(var i = 0; i <6 ; i++){
            li[i].style.backgroundColor='green';
            body.style.backgroundColor='#666'
        }
    }
    div[2].onclick=function () {
        for(var i = 0; i <6 ; i++){
            li[i].style.backgroundColor='black';
            li[i].style.color='#ffffff';
            body.style.backgroundColor='#ccc'
        }
    }


</script>
</body>
</html>